Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
escape-unicode
Advanced tools
escape-unicode is a Node.js library that can convert Unicode characters into their corresponding Unicode escapes ("\uxxxx" notation).
Install using npm
:
$ npm install --save escape-unicode
You'll need to have at least Node.js 8 or newer.
escapeUnicode(input[, start][, end])
Converts all characters within input
to Unicode escapes.
Optionally, a start
index can be provided to begin conversion at a specific location within input
. If start
is not
specified, null
, or negative, the conversion will begin at the start of input
.
Similarly, an end
index can be provided to stop conversion at a specific location within input
. If end
is not
specified, null
, or negative, the conversion will stop at the end of input
.
const escapeUnicode = require('escape-unicode');
escapeUnicode('♥');
//=> "\\u2665"
escapeUnicode('I ♥ Unicode!');
//=> "\\u0049\\u0020\\u2665\\u0020\\u0055\\u006e\\u0069\\u0063\\u006f\\u0064\\u0065\\u0021"
escapeUnicode('I ♥ Unicode!', 2, 3);
//=> "\\u2665"
If you have any problems with this library or would like to see changes currently in development you can do so here.
If you want to contribute, you're a legend! Information on how you can do so can be found in CONTRIBUTING.md. We want your suggestions and pull requests!
A list of contributors can be found in AUTHORS.md.
Copyright © 2018 Alasdair Mercer
See LICENSE.md for more information on our MIT license.
FAQs
Escapes Unicode characters
The npm package escape-unicode receives a total of 63,951 weekly downloads. As such, escape-unicode popularity was classified as popular.
We found that escape-unicode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.